from django import forms

from supergirl.models import PaymentRecord
from gideon.service.starlabs import GideonModelForm


class PaymentRecordModelForm(GideonModelForm):
    class Meta:
        model = PaymentRecord
        fields = ["pay_type", "paid_fee", "class_list", "note", ]


class PaymentRecordAndStudentModelForm(GideonModelForm):
    qq = forms.CharField(
        required=True,
        widget=forms.widgets.TextInput(attrs={'placeholder': 'QQ号'}),
        max_length=32,
        strip=True,
        label="QQ号",
        error_messages={
            'required': "QQ号未填",
        }
    )
    mobile = forms.CharField(
        required=True,
        widget=forms.widgets.TextInput(attrs={'placeholder': '手机号'}),
        strip=True,
        label="手机号",
        error_messages={
            'required': "手机号未填",
        }
    )
    emergency_contract = forms.CharField(
        required=False,
        widget=forms.widgets.TextInput(attrs={'placeholder': '紧急联系人电话'}),
        max_length=128,
        strip=True,
        label="紧急联系人电话",
        error_messages={
            'required': "紧急联系人电话未填",
        }
    )

    class Meta:
        model = PaymentRecord
        fields = ["pay_type", "paid_fee", "class_list", "qq", "mobile", "emergency_contract", "note", ]
